#lang racket

(define-struct ir (name price))

(define (sum-ir an-inv)
  (cond
    [(empty? an-inv) 0]
    [else (+ (ir-price (first an-inv)) (sum-ir (rest an-inv)))])
  )

(define (contains? asymbol an-inv)
  (cond
    [(empty? an-inv) false]
    [else (cond 
            [(str-cmp? (ir-name (first an-inv)) asymbol) true] 
            [else (contains? asymbol (rest an-inv))])])
  )

(define (str-cmp? s1 s2)
  (symbol=? s1 s2)
  )

; Test
(define an-ir-list
  (cons (make-ir 'dollar 1.26)
     (cons (make-ir 'robot 2.15)
        (cons (make-ir 'doll 3.90) empty)))
  )

(sum-ir an-ir-list)
(contains? 'robot an-ir-list)
